package november.search;

/**
 * @author huangxin
 * @date 2019/11/19-19:42
 */
public class SeqSearch {
    public static void main(String[] args) {
        int [ ] arr = {1,234,123,4,57,6,78,};
        int index = seqSearch(arr, 6);
        if (index==-1){
            System.out.println("没有找到");
        }else{
            System.out.println("下标为"+index);
            System.out.println(arr[index]);
        }
    }

    public static int seqSearch(int arr [ ] , int value){
        for (int i = 0; i < arr.length; i++) {
            if (arr[i]==value){
                return i;
            }
        }
        return -1;
    }
}
